<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>首页布局实战-导航菜单</title>
    <style>
        .m-menu{
            width: 100%;
            height: 50px;
            background: #3778bc;
            display: flex;
        }
        .m-menu-item{
            width: 108px;
            height: 50px;
            background: #3778bc;
            border-right: 1px solid #3a73af;
            position: relative;
            z-index: 999;
        }
        .m-menu-item .m-title{
            height: 50px;
            text-align:center;
            display: flex;
            justify-content: center;
            align-items: center;
            color: #ffffff;
            font-size: 15px;
        }
        .m-submenu>.m-menu-item{
            width: 175px;
            background: #4470ab;
        }
        .m-submenu>.m-menu-item .m-title{
            font-size: 14px;
        }
        .m-submenu{
            display: none;
        }
        .m-menu-item:hover{
            background: #316ca9;
        }
        .m-menu-item:hover >.m-submenu{
            display: block;
        }
        .m-submenu >.m-menu-item .m-menu-item{
            background: #4470ab;
            position: relative;
            left: 175px;
            top: -50px;
        }
        .m-submenu >.m-menu-item .m-menu-item .m-title{
            font-size: 12px;
        }
        .m-submenu >.m-menu-item .m-menu-item:hover{
            background: #3e6eaa;
        }

        ul,li {
            margin: 0;
            padding: 0;
            list-style: none;
        }
        ul.m-menu{
            width: 100%;
            height: 50px;
            background: #3778bc;
            display: flex;
        }
        ul.m-menu li{
            width: 108px;
            height: 50px;
            background: #3778bc;
            border-right: 1px solid #3a73af;
            position: relative;
            z-index: 999;
        }
        ul.m-menu li a{
            height: 50px;
            text-align:center;
            display: flex;
            justify-content: center;
            align-items: center;
            color: #ffffff;
            font-size: 15px;
        }
        ul.m-menu ul>li{
            width: 175px;
            background: #4470ab;
        }
        ul.m-menu ul>li a{
            font-size: 14px;
        }
        ul.m-menu ul{
            display: none;
        }
        ul.m-menu li:hover{
            background: #316ca9;
        }
        ul.m-menu li:hover >ul{
            display: block;
        }
        ul.m-menu ul >li li{
            background: #4470ab;
            position: relative;
            left: 175px;
            top: -50px;
        }
        ul.m-menu ul >li li a{
            font-size: 12px;
        }
        ul.m-menu ul >li li:hover{
            background: #3e6eaa;
        }
    </style>
</head>
<body>
    <h3>div+class的方式</h3>
    <div class="m-menu">
        <div class="m-menu-item">
          <a class="m-title">首页</a>
        </div>
        <div class="m-menu-item">
          <a class="m-title">一级菜单1</a>
          <div class="m-submenu">
            <div class="m-menu-item">
              <a class="m-title">二级菜单11</a>
            </div>
            <div class="m-menu-item">
              <a class="m-title">二级菜单12</a>
            </div>
            <div class="m-menu-item">
              <a class="m-title">二级菜单13</a>
            </div>
          </div>
        </div>
        <div class="m-menu-item">
            <a class="m-title">一级菜单2</a>
          <div class="m-submenu">
            <div class="m-menu-item">
              <a class="m-title">二级菜单21</a>
            </div>
            <div class="m-menu-item">
              <a class="m-title">二级菜单22</a>
            </div>
            <div class="m-menu-item">
              <a class="m-title">二级菜单23</a>
            </div>
          </div>
        </div>
        <div class="m-menu-item">
            <a class="m-title">一级菜单3</a>
          <div class="m-submenu">
            <div class="m-menu-item">
              <a class="m-title">二级菜单31</a>
            </div>
            <div class="m-menu-item">
              <a class="m-title">二级菜单32</a>
              <div class="m-submenu">
                <div class="m-menu-item">
                    <a class="m-title">三级菜单321</a>
                </div>
                <div class="m-menu-item">
                    <a class="m-title">三级菜单322</a>
                </div>
              </div>
            </div>
            <div class="m-menu-item">
              <a class="m-title">二级菜单33</a>
              <div class="m-submenu">
                <div class="m-menu-item">
                    <a class="m-title">三级菜单331</a>
                </div>
                <div class="m-menu-item">
                    <a class="m-title">三级菜单332</a>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <h3>ul+li的方式</h3>
      <ul class="m-menu">
        <li>
          <a>首页</a>
        </li>
        <li>
          <a>一级菜单1</a>
          <ul>
            <li>
              <a>二级菜单11</a>
            </li>
            <li>
              <a>二级菜单12</a>
            </li>
            <li>
              <a>二级菜单13</a>
            </li>
          </ul>
        </li>
        <li>
          <a>一级菜单2</a>
          <ul>
            <li>
              <a>二级菜单21</a>
            </li>
            <li>
              <a>二级菜单22</a>
            </li>
            <li>
              <a>二级菜单23</a>
            </li>
          </ul>
        </li>
        <li>
          <a>一级菜单3</a>
          <ul>
            <li>
              <a>二级菜单31</a>
            </li>
            <li>
              <a>二级菜单32</a>
              <ul>
                <li>
                  <a>三级菜单321</a>
                </li>
                <li>
                  <a>三级菜单322</a>
                </li>
              </ul>
            </li>
            <li>
              <a>二级菜单33</a>
              <ul>
                <li>
                  <a>三级菜单331</a>
                </li>
                <li>
                  <a>三级菜单332</a>
                </li>
              </ul>
            </li>
          </ul>
        </li>
      </ul>
</body>
</html>